rofiles-fuse: Rework to be based on nlink
authorColin Walters <walters@verbum.org>
Tue, 16 Aug 2016 13:26:16 +0000 (09:26 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 16 Aug 2016 21:22:28 +0000 (21:22 +0000)
commit77af6844d8330b31d58080076afb31e08974ce09
treec7db0b6e19a0c3f3923eca7189ea9138f4cac4d1
parent3469161e4157d715285395e80202c9d2dbd43ce8
rofiles-fuse: Rework to be based on nlink

Programs like `useradd` try to `open(/etc/passwd, O_RDWR)` to append,
which didn't work with rofiles-fuse.  Thinking about this, I realized
that there's a simpler algorithm for "can we write to this file" which
is "does it have a hardlink count <= 1"?

Switching to this both drops complexity (we no longer need to keep a
hash table of files we created), and also lets useradd work.

Closes: #462
Approved by: jlebon
src/rofiles-fuse/main.c